import { defineStore } from "pinia";
import { ref } from "vue";

const userStore = defineStore(
    'user',
    () => {

        const userInfo = ref('');

        //2.定义修改userInfo的方法
        const setUserInfo = (newUserInfo) => {
            userInfo.value = newUserInfo
        }

        //3.定义移除userInfo的方法
        const removeUserInfo = () => {
            userInfo.value = ''
        }
        return {
            userInfo,setUserInfo,removeUserInfo
        }
    },
    {
        persist:true
    }
)

export default userStore;